#ifndef GAME_H
#define GAME_H

// Common includes
#include <Common/Base/hkBase.h>
#include <Common/Base/Memory/System/Util/hkMemoryInitUtil.h>
#include <Common/Base/Memory/Allocator/Malloc/hkMallocAllocator.h>
// Physics includes
#include <Physics\Collide\Shape\Convex\Cylinder\hkpCylinderShape.h>
#include <Physics/Collide/Shape/Convex/Sphere/hkpSphereShape.h>
#include <Physics\Collide\Shape\Convex\Box\hkpBoxShape.h>
#include <Physics/Collide/Shape/Convex/Cylinder/hkpCylinderShape.h>
#include <Physics/Collide/Dispatch/hkpAgentRegisterUtil.h>
#include <Physics/Dynamics/hkpDynamics.h>
#include <Physics/Dynamics/World/hkpWorld.h>
#include <Physics/Dynamics/Entity/hkpRigidBody.h>
#include <Physics/Utilities/Dynamics/Inertia/hkpInertiaTensorComputer.h>
#include <Physics/Dynamics/World/hkpPhysicsSystem.h>
#include <Physics/Dynamics/Constraint/Bilateral/StiffSpring/hkpStiffSpringConstraintData.h>
#include <Physics\Vehicle\hkpVehicleInstance.h>
#include <Physics\Vehicle\Camera\hkp1dAngularFollowCam.h>

#include <Graphics/Common/Input/Pad/hkgPad.h>

#include <Common\Visualize\hkVisualDebugger.h>

static const float FRAME_PERIOD = 0.01667f; // ~60 fps

class Game {
public:
	Game();
	~Game();

	//steer the vehicle; step the hkpWorld; sync the display wheels; update the camera
	void step();
	void resetVehicle();

	hkpVehicleInstance* m_vehicle;
	hkpRigidBody* m_wall[10];
	hkpRigidBody* m_wheels[4];

	hkp1dAngularFollowCam::CameraOutput out;

	int accelerate;
	int steer;
protected:
	void buildLandscape();
	void createVehicle(hkpRigidBody* chassis);
	void createDisplayWheels(hkReal radius = 0.4f, hkReal thickness = 0.2f);
	void buildWall();

	//user input to drive vehicle
	hkReal m_inputXPosition;
	hkReal m_inputYPosition;

	hkgPad* pad;

	hkp1dAngularFollowCam m_camera;

	int m_tag;

	hkArray<int> m_displayWheelId;

	hkpWorld* m_world;

	hkVisualDebugger* visualDebugger;
};

#endif